/**
 * @param {string} s
 * @return {number}
 */
var minOperations = function (s) {
  let n = s.length 
  let startOfEvent = 0,startOfOdd = 0
  for (let i = 0; i < n; i++) {
    // 只有两种情况 偶数位为0，奇数位为1；偶数位为1，奇数位为0
    if( s[i] == i%2 ){
      startOfOdd++
    }else{
      startOfEvent++
    }

  }
  return Math.min(startOfEvent,startOfOdd)
};
var s = "0100"
console.log(minOperations(s))
